package com.yanqu.road.server.cmd.activity.bulletscreen;

import com.yanqu.road.pb.activity.BulletScreenProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.bulletscreen.BulletScreenModule;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;

import java.util.List;

@Cmd(code = GameProtocol.S_ACTIVITY_LIST_BULLET_SCREEN_COMMENTS_FROM_CROSS, desc = "弹幕列表")
public class BulletScreenContentListCmdFromCross extends AbstractCommand {


    int activityId;
    long totalMsgSize;
    List<BulletScreenProto.ActivityBarrageMessageTemp> list;
    long firstMsgTime;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        BulletScreenProto.CrossBulletScreenContentListRespMsg reqMsg = BulletScreenProto.CrossBulletScreenContentListRespMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        totalMsgSize = reqMsg.getTotalMsgSize();
        list = reqMsg.getMsgList();
        firstMsgTime = reqMsg.getFirstMsgTime();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        player.getModule(BulletScreenModule.class).bulletScreenMsgListFromCross(activityId, totalMsgSize, firstMsgTime, list);

    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
